home *** CD-ROM | disk | FTP | other *** search
/ The Arsenal Files 8 / The Arsenal Files Collection #8 (Arsenal Computer) (1996).ISO / g_quake / dmmde321.zip / CLIENT.QC < prev    next >
Text File  |  1996-09-04  |  38KB  |  1,521 lines

  1.  
  2. // prototypes
  3. void () W_WeaponFrame;
  4. void() W_SetCurrentAmmo;
  5. void() player_pain;
  6. void() player_stand1;
  7. void (vector org) spawn_tfog;
  8. void (vector org, entity death_owner) spawn_tdeath;
  9.  
  10. float    modelindex_eyes, modelindex_player;
  11.  
  12. /*
  13. =============================================================================
  14.  
  15.                 LEVEL CHANGING / INTERMISSION
  16.  
  17. =============================================================================
  18. */
  19.  
  20. float    intermission_running;
  21. float    intermission_exittime;
  22.  
  23. /*QUAKED info_intermission (1 0.5 0.5) (-16 -16 -16) (16 16 16)
  24. This is the camera point for the intermission.
  25. Use mangle instead of angle, so you can set pitch or roll as well as yaw.  'pitch roll yaw'
  26. */
  27. void() info_intermission =
  28. {
  29. };
  30.  
  31.  
  32.  
  33. void() SetChangeParms =
  34. {
  35. // remove items
  36.     self.items = self.items - (self.items & 
  37.     (IT_KEY1 | IT_KEY2 | IT_INVISIBILITY | IT_INVULNERABILITY | IT_SUIT | IT_QUAD) );
  38.     
  39. // cap super health
  40.     if (self.health > 100)
  41.         self.health = 100;
  42.     if (self.health < 50)
  43.         self.health = 50;
  44.     parm1 = self.items;
  45.     parm2 = self.health;
  46.     parm3 = self.armorvalue;
  47.     if (self.ammo_shells < 25)
  48.         parm4 = 25;
  49.     else
  50.         parm4 = self.ammo_shells;
  51.     parm5 = self.ammo_nails;
  52.     parm6 = self.ammo_rockets;
  53.     parm7 = self.ammo_cells;
  54.     parm8 = self.weapon;
  55.     parm9 = self.armortype * 100;
  56. };
  57.  
  58. void() SetNewParms =
  59. {
  60.         if (deathmatch != 7)
  61.                 parm1 = IT_SHOTGUN | IT_AXE;
  62.         else
  63.                 parm1 = IT_AXE | IT_SHOTGUN | IT_SUPER_SHOTGUN |
  64.                         IT_NAILGUN | IT_SUPER_NAILGUN |
  65.                         IT_GRENADE_LAUNCHER | IT_ROCKET_LAUNCHER |
  66.                         IT_LIGHTNING;
  67.     parm2 = 100;
  68.     parm3 = 0;
  69.     parm4 = 25;
  70.     parm5 = 0;
  71.     parm6 = 0;
  72.     parm6 = 0;
  73.     parm8 = 1;
  74.     parm9 = 0;
  75. };
  76.  
  77. void() DecodeLevelParms =
  78. {
  79.     if (serverflags)
  80.     {
  81.         if (world.model == "maps/start.bsp")
  82.             SetNewParms ();        // take away all stuff on starting new episode
  83.     }
  84.     
  85.     self.items = parm1;
  86.     self.health = parm2;
  87.     self.armorvalue = parm3;
  88.     self.ammo_shells = parm4;
  89.     self.ammo_nails = parm5;
  90.     self.ammo_rockets = parm6;
  91.     self.ammo_cells = parm7;
  92.     self.weapon = parm8;
  93.     self.armortype = parm9 * 0.01;
  94. };
  95.  
  96. /*
  97. ============
  98. FindIntermission
  99.  
  100. Returns the entity to view from
  101. ============
  102. */
  103. entity() FindIntermission =
  104. {
  105.     local    entity spot;
  106.     local    float cyc;
  107.  
  108. // look for info_intermission first
  109.     spot = find (world, classname, "info_intermission");
  110.     if (spot)
  111.     {    // pick a random one
  112.         cyc = random() * 4;
  113.         while (cyc > 1)
  114.         {
  115.             spot = find (spot, classname, "info_intermission");
  116.             if (!spot)
  117.                 spot = find (spot, classname, "info_intermission");
  118.             cyc = cyc - 1;
  119.         }
  120.         return spot;
  121.     }
  122.  
  123. // then look for the start position
  124.     spot = find (world, classname, "info_player_start");
  125.     if (spot)
  126.         return spot;
  127.     
  128. // testinfo_player_start is only found in regioned levels
  129.     spot = find (world, classname, "testplayerstart");
  130.     if (spot)
  131.         return spot;
  132.     
  133.     objerror ("FindIntermission: no spot");
  134. };
  135.  
  136.  
  137. string nextmap;
  138. void() GotoNextMap =
  139. {
  140.     if (cvar("samelevel"))    // if samelevel is set, stay on same level
  141.         changelevel (mapname);
  142.     else
  143.         changelevel (nextmap);
  144. };
  145.  
  146.  
  147. void() ExitIntermission =
  148. {
  149. // skip any text in deathmatch
  150.     if (deathmatch)
  151.     {
  152.         GotoNextMap ();
  153.         return;
  154.     }
  155.     
  156.     intermission_exittime = time + 1;
  157.     intermission_running = intermission_running + 1;
  158.  
  159. //
  160. // run some text if at the end of an episode
  161. //
  162.     if (intermission_running == 2)
  163.     {
  164.         if (world.model == "maps/e1m7.bsp")
  165.         {
  166.             WriteByte (MSG_ALL, SVC_CDTRACK);
  167.             WriteByte (MSG_ALL, 2);
  168.             WriteByte (MSG_ALL, 3);
  169.             if (!cvar("registered"))
  170.             {
  171.                 WriteByte (MSG_ALL, SVC_FINALE);
  172.                 WriteString (MSG_ALL, "As the corpse of the monstrous entity\nChthon sinks back into the lava whence\nit rose, you grip the Rune of Earth\nMagic tightly. Now that you have\nconquered the Dimension of the Doomed,\nrealm of Earth Magic, you are ready to\ncomplete your task in the other three\nhaunted lands of Quake. Or are you? If\nyou don't register Quake, you'll never\nknow what awaits you in the Realm of\nBlack Magic, the Netherworld, and the\nElder World!");
  173.             }
  174.             else
  175.             {
  176.                 WriteByte (MSG_ALL, SVC_FINALE);
  177.                 WriteString (MSG_ALL, "As the corpse of the monstrous entity\nChthon sinks back into the lava whence\nit rose, you grip the Rune of Earth\nMagic tightly. Now that you have\nconquered the Dimension of the Doomed,\nrealm of Earth Magic, you are ready to\ncomplete your task. A Rune of magic\npower lies at the end of each haunted\nland of Quake. Go forth, seek the\ntotality of the four Runes!");
  178.             }
  179.             return;
  180.         }
  181.         else if (world.model == "maps/e2m6.bsp")
  182.         {
  183.             WriteByte (MSG_ALL, SVC_CDTRACK);
  184.             WriteByte (MSG_ALL, 2);
  185.             WriteByte (MSG_ALL, 3);
  186.  
  187.             WriteByte (MSG_ALL, SVC_FINALE);
  188.             WriteString (MSG_ALL, "The Rune of Black Magic throbs evilly in\nyour hand and whispers dark thoughts\ninto your brain. You learn the inmost\nlore of the Hell-Mother; Shub-Niggurath!\nYou now know that she is behind all the\nterrible plotting which has led to so\nmuch death and horror. But she is not\ninviolate! Armed with this Rune, you\nrealize that once all four Runes are\ncombined, the gate to Shub-Niggurath's\nPit will open, and you can face the\nWitch-Goddess herself in her frightful\notherworld cathedral.");
  189.             return;
  190.         }
  191.         else if (world.model == "maps/e3m6.bsp")
  192.         {
  193.             WriteByte (MSG_ALL, SVC_CDTRACK);
  194.             WriteByte (MSG_ALL, 2);
  195.             WriteByte (MSG_ALL, 3);
  196.  
  197.             WriteByte (MSG_ALL, SVC_FINALE);
  198.             WriteString (MSG_ALL, "The charred viscera of diabolic horrors\nbubble viscously as you seize the Rune\nof Hell Magic. Its heat scorches your\nhand, and its terrible secrets blight\nyour mind. Gathering the shreds of your\ncourage, you shake the devil's shackles\nfrom your soul, and become ever more\nhard and determined to destroy the\nhideous creatures whose mere existence\nthreatens the souls and psyches of all\nthe population of Earth.");
  199.             return;
  200.         }
  201.         else if (world.model == "maps/e4m7.bsp")
  202.         {
  203.             WriteByte (MSG_ALL, SVC_CDTRACK);
  204.             WriteByte (MSG_ALL, 2);
  205.             WriteByte (MSG_ALL, 3);
  206.  
  207.             WriteByte (MSG_ALL, SVC_FINALE);
  208.             WriteString (MSG_ALL, "Despite the awful might of the Elder\nWorld, you have achieved the Rune of\nElder Magic, capstone of all types of\narcane wisdom. Beyond good and evil,\nbeyond life and death, the Rune\npulsates, heavy with import. Patient and\npotent, the Elder Being Shub-Niggurath\nweaves her dire plans to clear off all\nlife from the Earth, and bring her own\nfoul offspring to our world! For all the\ndwellers in these nightmare dimensions\nare her descendants! Once all Runes of\nmagic power are united, the energy\nbehind them will blast open the Gateway\nto Shub-Niggurath, and you can travel\nthere to foil the Hell-Mother's plots\nin person.");
  209.             return;
  210.         }
  211.  
  212.         GotoNextMap();
  213.     }
  214.     
  215.     if (intermission_running == 3)
  216.     {
  217.         if (!cvar("registered"))
  218.         {    // shareware episode has been completed, go to sell screen
  219.             WriteByte (MSG_ALL, SVC_SELLSCREEN);
  220.             return;
  221.         }
  222.         
  223.         if ( (serverflags&15) == 15)
  224.         {
  225.             WriteByte (MSG_ALL, SVC_FINALE);
  226.             WriteString (MSG_ALL, "Now, you have all four Runes. You sense\ntremendous invisible forces moving to\nunseal ancient barriers. Shub-Niggurath\nhad hoped to use the Runes Herself to\nclear off the Earth, but now instead,\nyou will use them to enter her home and\nconfront her as an avatar of avenging\nEarth-life. If you defeat her, you will\nbe remembered forever as the savior of\nthe planet. If she conquers, it will be\nas if you had never been born.");
  227.             return;
  228.         }
  229.         
  230.     }
  231.  
  232.     GotoNextMap();
  233. };
  234.  
  235. /*
  236. ============
  237. IntermissionThink
  238.  
  239. When the player presses attack or jump, change to the next level
  240. ============
  241. */
  242. void() IntermissionThink =
  243. {
  244.     if (time < intermission_exittime)
  245.         return;
  246.  
  247.     if (!self.button0 && !self.button1 && !self.button2)
  248.         return;
  249.     
  250.     ExitIntermission ();
  251. };
  252.  
  253. void() execute_changelevel =
  254. {
  255.     local entity    pos;
  256.  
  257.     intermission_running = 1;
  258.     
  259. // enforce a wait time before allowing changelevel
  260.     if (deathmatch)
  261.         intermission_exittime = time + 5;
  262.     else
  263.         intermission_exittime = time + 2;
  264.  
  265.     WriteByte (MSG_ALL, SVC_CDTRACK);
  266.     WriteByte (MSG_ALL, 3);
  267.     WriteByte (MSG_ALL, 3);
  268.     
  269.     pos = FindIntermission ();
  270.  
  271.     other = find (world, classname, "player");
  272.     while (other != world)
  273.     {
  274.         other.view_ofs = '0 0 0';
  275.         other.angles = other.v_angle = pos.mangle;
  276.         other.fixangle = TRUE;        // turn this way immediately
  277.         other.nextthink = time + 0.5;
  278.         other.takedamage = DAMAGE_NO;
  279.         other.solid = SOLID_NOT;
  280.         other.movetype = MOVETYPE_NONE;
  281.         other.modelindex = 0;
  282.         setorigin (other, pos.origin);
  283.         other = find (other, classname, "player");
  284.     }    
  285.  
  286.     WriteByte (MSG_ALL, SVC_INTERMISSION);
  287. };
  288.  
  289.  
  290. void() changelevel_touch =
  291. {
  292.     local entity    pos;
  293.  
  294.     if (other.classname != "player")
  295.         return;
  296.  
  297.     if (cvar("noexit"))
  298.     {
  299.         T_Damage (other, self, self, 50000);
  300.         return;
  301.     }
  302.     bprint (other.netname);
  303.     bprint (" exited the level\n");
  304.     
  305.     nextmap = self.map;
  306.  
  307.     SUB_UseTargets ();
  308.  
  309.     if ( (self.spawnflags & 1) && (deathmatch == 0) )
  310.     {    // NO_INTERMISSION
  311.         GotoNextMap();
  312.         return;
  313.     }
  314.     
  315.     self.touch = SUB_Null;
  316.  
  317. // we can't move people right now, because touch functions are called
  318. // in the middle of C movement code, so set a think time to do it
  319.     self.think = execute_changelevel;
  320.     self.nextthink = time + 0.1;
  321. };
  322.  
  323. /*QUAKED trigger_changelevel (0.5 0.5 0.5) ? NO_INTERMISSION
  324. When the player touches this, he gets sent to the map listed in the "map" variable.  Unless the NO_INTERMISSION flag is set, the view will go to the info_intermission spot and display stats.
  325. */
  326. void() trigger_changelevel =
  327. {
  328.     if (!self.map)
  329.         objerror ("chagnelevel trigger doesn't have map");
  330.     
  331.     InitTrigger ();
  332.     self.touch = changelevel_touch;
  333. };
  334.  
  335.  
  336. /*
  337. =============================================================================
  338.  
  339.                 PLAYER GAME EDGE FUNCTIONS
  340.  
  341. =============================================================================
  342. */
  343.  
  344. void() set_suicide_frame;
  345.  
  346. // called by ClientKill and DeadThink
  347. void() respawn =
  348. {
  349.     if (coop)
  350.     {
  351.         // make a copy of the dead body for appearances sake
  352.         CopyToBodyQue (self);
  353.         // get the spawn parms as they were at level start
  354.         setspawnparms (self);
  355.         // respawn        
  356.         PutClientInServer ();
  357.     }
  358.     else if (deathmatch)
  359.     {
  360.         // make a copy of the dead body for appearances sake
  361.         CopyToBodyQue (self);
  362.         // set default spawn parms
  363.         SetNewParms ();
  364.         // respawn        
  365.         PutClientInServer ();
  366.     }
  367.     else
  368.     {    // restart the entire server
  369.         localcmd ("restart\n");
  370.     }
  371. };
  372.  
  373.  
  374. /*
  375. ============
  376. ClientKill
  377.  
  378. Player entered the suicide command
  379. ============
  380. */
  381. void() ClientKill =
  382. {
  383.     bprint (self.netname);
  384.     bprint (" suicides\n");
  385.     set_suicide_frame ();
  386.     self.modelindex = modelindex_player;
  387.     self.frags = self.frags - 2;    // extra penalty
  388.     respawn ();
  389. };
  390.  
  391. float(vector v) CheckSpawnPoint =
  392. {
  393.     return FALSE;
  394. };
  395.  
  396. /*
  397. ============
  398. SelectSpawnPoint
  399.  
  400. Returns the entity to spawn at
  401. ============
  402. */
  403. entity() SelectSpawnPoint =
  404. {
  405.     local    entity spot;
  406.     
  407. // testinfo_player_start is only found in regioned levels
  408.     spot = find (world, classname, "testplayerstart");
  409.     if (spot)
  410.         return spot;
  411.         
  412. // choose a info_player_deathmatch point
  413.     if (coop)
  414.     {
  415.         lastspawn = find(lastspawn, classname, "info_player_coop");
  416.         if (lastspawn == world)
  417.             lastspawn = find (lastspawn, classname, "info_player_start");
  418.         if (lastspawn != world)
  419.             return lastspawn;
  420.     }
  421.     else if (deathmatch)
  422.     {
  423.         lastspawn = find(lastspawn, classname, "info_player_deathmatch");
  424.         if (lastspawn == world)
  425.             lastspawn = find (lastspawn, classname, "info_player_deathmatch");
  426.         if (lastspawn != world)
  427.             return lastspawn;
  428.     }
  429.  
  430.     if (serverflags)
  431.     {    // return with a rune to start
  432.         spot = find (world, classname, "info_player_start2");
  433.         if (spot)
  434.             return spot;
  435.     }
  436.     
  437.     spot = find (world, classname, "info_player_start");
  438.     if (!spot)
  439.         error ("PutClientInServer: no info_player_start on level");
  440.     
  441.     return spot;
  442. };
  443.  
  444. /*
  445. ===========
  446. PutClientInServer
  447.  
  448. called each time a player is spawned
  449. ============
  450. */
  451. void() DecodeLevelParms;
  452. void() PlayerDie;
  453.  
  454.  
  455. void() PutClientInServer =
  456. {
  457.     local    entity spot;
  458.  
  459.     self.classname = "player";
  460.     self.health = 100;
  461.     self.takedamage = DAMAGE_AIM;
  462.     self.solid = SOLID_SLIDEBOX;
  463.     self.movetype = MOVETYPE_WALK;
  464.     self.show_hostile = 0;
  465.     self.max_health = 100;
  466.     self.flags = FL_CLIENT;
  467.     self.air_finished = time + 12;
  468.     self.dmg = 2;           // initial water damage
  469.     self.super_damage_finished = 0;
  470.     self.radsuit_finished = 0;
  471.     self.invisible_finished = 0;
  472.     self.invincible_finished = 0;
  473.     self.effects = 0;
  474.     self.invincible_time = 0;
  475.  
  476.     DecodeLevelParms ();
  477.     
  478.     W_SetCurrentAmmo ();
  479.  
  480.     self.attack_finished = time;
  481.     self.th_pain = player_pain;
  482.     self.th_die = PlayerDie;
  483.     
  484.     self.deadflag = DEAD_NO;
  485. // paustime is set by teleporters to keep the player from moving a while
  486.     self.pausetime = 0;
  487.     
  488.     spot = SelectSpawnPoint ();
  489.  
  490.     self.origin = spot.origin + '0 0 1';
  491.     self.angles = spot.angles;
  492.     self.fixangle = TRUE;        // turn this way immediately
  493.  
  494. // oh, this is a hack!
  495.     setmodel (self, "progs/eyes.mdl");
  496.     modelindex_eyes = self.modelindex;
  497.  
  498.     setmodel (self, "progs/player.mdl");
  499.     modelindex_player = self.modelindex;
  500.  
  501.     setsize (self, VEC_HULL_MIN, VEC_HULL_MAX);
  502.     
  503.     self.view_ofs = '0 0 22';
  504.  
  505.     player_stand1 ();
  506.     
  507.     if (deathmatch || coop)
  508.     {
  509.         makevectors(self.angles);
  510.         spawn_tfog (self.origin + v_forward*20);
  511.     }
  512.  
  513.     spawn_tdeath (self.origin, self);
  514. };
  515.  
  516.  
  517. /*
  518. =============================================================================
  519.  
  520.                 QUAKED FUNCTIONS
  521.  
  522. =============================================================================
  523. */
  524.  
  525.  
  526. /*QUAKED info_player_start (1 0 0) (-16 -16 -24) (16 16 24)
  527. The normal starting point for a level.
  528. */
  529. void() info_player_start =
  530. {
  531. };
  532.  
  533.  
  534. /*QUAKED info_player_start2 (1 0 0) (-16 -16 -24) (16 16 24)
  535. Only used on start map for the return point from an episode.
  536. */
  537. void() info_player_start2 =
  538. {
  539. };
  540.  
  541.  
  542. /*
  543. saved out by quaked in region mode
  544. */
  545. void() testplayerstart =
  546. {
  547. };
  548.  
  549. /*QUAKED info_player_deathmatch (1 0 1) (-16 -16 -24) (16 16 24)
  550. potential spawning position for deathmatch games
  551. */
  552. void() info_player_deathmatch =
  553. {
  554. };
  555.  
  556. /*QUAKED info_player_coop (1 0 1) (-16 -16 -24) (16 16 24)
  557. potential spawning position for coop games
  558. */
  559. void() info_player_coop =
  560. {
  561. };
  562.  
  563. /*
  564. ===============================================================================
  565.  
  566. RULES
  567.  
  568. ===============================================================================
  569. */
  570.  
  571. void(entity c) PrintClientScore =
  572. {
  573.     if (c.frags > -10 && c.frags < 0)
  574.         bprint (" ");
  575.     else if (c.frags >= 0)
  576.     {
  577.         if (c.frags < 100)
  578.             bprint (" ");
  579.         if (c.frags < 10)
  580.             bprint (" ");
  581.     }
  582.     bprint (ftos(c.frags));
  583.     bprint (" ");
  584.     bprint (c.netname);
  585.     bprint ("\n");
  586. };
  587.  
  588. void() DumpScore =
  589. {
  590.     local entity    e, sort, walk;
  591.  
  592.     if (world.chain)
  593.         error ("DumpScore: world.chain is set");
  594.  
  595. // build a sorted lis
  596.     e = find(world, classname, "player");
  597.     sort = world;
  598.     while (e)
  599.     {
  600.         if (!sort)
  601.         {
  602.             sort = e;
  603.             e.chain = world;
  604.         }
  605.         else
  606.         {
  607.             if (e.frags > sort.frags)
  608.             {
  609.                 e.chain = sort;
  610.                 sort = e;
  611.             }
  612.             else
  613.             {
  614.                 walk = sort;
  615.                 do
  616.                 {
  617.                     if (!walk.chain)
  618.                     {
  619.                         e.chain = world;
  620.                         walk.chain = e;
  621.                     }
  622.                     else if (walk.chain.frags < e.frags)
  623.                     {
  624.                         e.chain = walk.chain;
  625.                         walk.chain = e;
  626.                     }
  627.                     else
  628.                         walk = walk.chain;
  629.                 } while (walk.chain != e);
  630.             }
  631.         }
  632.         
  633.         e = find(e, classname, "player");
  634.     }
  635.  
  636. // print the list
  637.     
  638.     bprint ("\n");    
  639.     while (sort)
  640.     {
  641.         PrintClientScore (sort);
  642.         sort = sort.chain;
  643.     }
  644.     bprint ("\n");
  645. };
  646.  
  647. /*
  648. go to the next level for deathmatch
  649. */
  650. void() NextLevel =
  651. {
  652.     local entity o;
  653.  
  654. // find a trigger changelevel
  655.     o = find(world, classname, "trigger_changelevel");
  656.         if ((deathmatch) && (mapname == "end"))
  657.                 nextmap = "start";
  658.         else
  659.     if (!o || mapname == "start")
  660.     {    // go back to same map if no trigger_changelevel
  661.                 // Not anymore...  fixing this nextlevel start loop bug
  662.                 if (!cvar("registered"))
  663.                         nextmap = "e1m1";
  664.                 else
  665.                 if (random() < 0.25)
  666.                         nextmap = "e1m1";
  667.                 else
  668.                 if (random() < 0.25)
  669.                         nextmap = "e2m1";
  670.                 else
  671.                 if (random() < 0.25)
  672.                         nextmap = "e3m1";
  673.                 else
  674.                         nextmap = "e4m1";
  675.  
  676.     }
  677.  
  678.     nextmap = o.map;
  679.     
  680.     if (o.nextthink < time)
  681.     {
  682.         o.think = execute_changelevel;
  683.         o.nextthink = time + 0.1;
  684.     }
  685. };
  686.  
  687. /*
  688. ============
  689. CheckRules
  690.  
  691. Exit deathmatch games upon conditions
  692. ============
  693. */
  694. void() CheckRules =
  695. {
  696.     local    float        timelimit;
  697.     local    float        fraglimit;
  698.     
  699.     if (gameover)    // someone else quit the game already
  700.         return;
  701.         
  702.     timelimit = cvar("timelimit") * 60;
  703.     fraglimit = cvar("fraglimit");
  704.     
  705.     if (timelimit && time >= timelimit)
  706.     {
  707. NextLevel ();
  708. /*
  709.         gameover = TRUE;
  710.         bprint ("\n\n\n==============================\n");
  711.         bprint ("game exited after ");
  712.         bprint (ftos(timelimit/60));
  713.         bprint (" minutes\n");
  714.         DumpScore ();
  715.         localcmd ("killserver\n");
  716. */
  717.         return;
  718.     }
  719.     
  720.     if (fraglimit && self.frags >= fraglimit)
  721.     {
  722. NextLevel ();
  723. /*
  724.         gameover = TRUE;
  725.         bprint ("\n\n\n==============================\n");
  726.         bprint ("game exited after ");
  727.         bprint (ftos(self.frags));
  728.         bprint (" frags\n");
  729.         DumpScore ();
  730.         localcmd ("killserver\n");
  731. */
  732.         return;
  733.     }    
  734. };
  735.  
  736. //============================================================================
  737.  
  738. void() PlayerDeathThink =
  739. {
  740.     local entity    old_self;
  741.     local float        forward;
  742.  
  743.     if ((self.flags & FL_ONGROUND))
  744.     {
  745.         forward = vlen (self.velocity);
  746.         forward = forward - 20;
  747.         if (forward <= 0)
  748.             self.velocity = '0 0 0';
  749.         else    
  750.             self.velocity = forward * normalize(self.velocity);
  751.     }
  752.  
  753. // wait for all buttons released
  754.     if (self.deadflag == DEAD_DEAD)
  755.     {
  756.         if (self.button2 || self.button1 || self.button0)
  757.             return;
  758.         self.deadflag = DEAD_RESPAWNABLE;
  759.         return;
  760.     }
  761.  
  762. // wait for any button down
  763.     if (!self.button2 && !self.button1 && !self.button0)
  764.         return;
  765.  
  766.     self.button0 = 0;
  767.     self.button1 = 0;
  768.     self.button2 = 0;
  769.     respawn();
  770. };
  771.  
  772.  
  773. void() PlayerJump =
  774. {
  775.     local vector start, end;
  776.     
  777.     if (self.flags & FL_WATERJUMP)
  778.         return;
  779.     
  780.     if (self.waterlevel >= 2)
  781.     {
  782.         if (self.watertype == CONTENT_WATER)
  783.             self.velocity_z = 100;
  784.         else if (self.watertype == CONTENT_SLIME)
  785.             self.velocity_z = 80;
  786.         else
  787.             self.velocity_z = 50;
  788.  
  789. // play swiming sound
  790.         if (self.swim_flag < time)
  791.         {
  792.             self.swim_flag = time + 1;
  793.             if (random() < 0.5)
  794.                 sound (self, CHAN_BODY, "misc/water1.wav", 1, ATTN_NORM);
  795.             else
  796.                 sound (self, CHAN_BODY, "misc/water2.wav", 1, ATTN_NORM);
  797.         }
  798.  
  799.         return;
  800.     }
  801.  
  802.     if (!(self.flags & FL_ONGROUND))
  803.         return;
  804.  
  805.     if ( !(self.flags & FL_JUMPRELEASED) )
  806.         return;        // don't pogo stick
  807.  
  808.     self.flags = self.flags - (self.flags & FL_JUMPRELEASED);
  809.  
  810.     self.flags = self.flags - FL_ONGROUND;    // don't stairwalk
  811.     
  812.     self.button2 = 0;
  813. // player jumping sound
  814.     sound (self, CHAN_BODY, "player/plyrjmp8.wav", 1, ATTN_NORM);
  815.     self.velocity_z = self.velocity_z + 270;
  816. };
  817.  
  818.  
  819. /*
  820. ===========
  821. WaterMove
  822.  
  823. ============
  824. */
  825. .float    dmgtime;
  826.  
  827. void() WaterMove =
  828. {
  829. //dprint (ftos(self.waterlevel));
  830.     if (self.movetype == MOVETYPE_NOCLIP)
  831.         return;
  832.     if (self.health < 0)
  833.         return;
  834.  
  835.     if (self.waterlevel != 3)
  836.     {
  837.         if (self.air_finished < time)
  838.             sound (self, CHAN_VOICE, "player/gasp2.wav", 1, ATTN_NORM);
  839.         else if (self.air_finished < time + 9)
  840.             sound (self, CHAN_VOICE, "player/gasp1.wav", 1, ATTN_NORM);
  841.         self.air_finished = time + 12;
  842.         self.dmg = 2;
  843.     }
  844.     else if (self.air_finished < time)
  845.     {    // drown!
  846.         if (self.pain_finished < time)
  847.         {
  848.             self.dmg = self.dmg + 2;
  849.             if (self.dmg > 15)
  850.                 self.dmg = 10;
  851.             T_Damage (self, world, world, self.dmg);
  852.             self.pain_finished = time + 1;
  853.         }
  854.     }
  855.     
  856.     if (!self.waterlevel)
  857.     {
  858.         if (self.flags & FL_INWATER)
  859.         {    
  860.             // play leave water sound
  861.             sound (self, CHAN_BODY, "misc/outwater.wav", 1, ATTN_NORM);
  862.             self.flags = self.flags - FL_INWATER;
  863.         }
  864.         return;
  865.     }
  866.  
  867.     if (self.watertype == CONTENT_LAVA)
  868.     {    // do damage
  869.         if (self.dmgtime < time)
  870.         {
  871.             if (self.radsuit_finished > time)
  872.                 self.dmgtime = time + 1;
  873.             else
  874.                 self.dmgtime = time + 0.2;
  875.  
  876.             T_Damage (self, world, world, 10*self.waterlevel);
  877.         }
  878.     }
  879.     else if (self.watertype == CONTENT_SLIME)
  880.     {    // do damage
  881.         if (self.dmgtime < time && self.radsuit_finished < time)
  882.         {
  883.             self.dmgtime = time + 1;
  884.             T_Damage (self, world, world, 4*self.waterlevel);
  885.         }
  886.     }
  887.     
  888.     if ( !(self.flags & FL_INWATER) )
  889.     {    
  890.  
  891. // player enter water sound
  892.  
  893.         if (self.watertype == CONTENT_LAVA)
  894.             sound (self, CHAN_BODY, "player/inlava.wav", 1, ATTN_NORM);
  895.         if (self.watertype == CONTENT_WATER)
  896.             sound (self, CHAN_BODY, "player/inh2o.wav", 1, ATTN_NORM);
  897.         if (self.watertype == CONTENT_SLIME)
  898.             sound (self, CHAN_BODY, "player/slimbrn2.wav", 1, ATTN_NORM);
  899.  
  900.         self.flags = self.flags + FL_INWATER;
  901.         self.dmgtime = 0;
  902.     }
  903.     
  904.     if (! (self.flags & FL_WATERJUMP) )
  905.         self.velocity = self.velocity - 0.8*self.waterlevel*frametime*self.velocity;
  906. };
  907.  
  908. void() CheckWaterJump =
  909. {
  910.     local vector start, end;
  911.  
  912. // check for a jump-out-of-water
  913.     makevectors (self.angles);
  914.     start = self.origin;
  915.     start_z = start_z + 8; 
  916.     v_forward_z = 0;
  917.     normalize(v_forward);
  918.     end = start + v_forward*24;
  919.     traceline (start, end, TRUE, self);
  920.     if (trace_fraction < 1)
  921.     {    // solid at waist
  922.         start_z = start_z + self.maxs_z - 8;
  923.         end = start + v_forward*24;
  924.         self.movedir = trace_plane_normal * -50;
  925.         traceline (start, end, TRUE, self);
  926.         if (trace_fraction == 1)
  927.         {    // open at eye level
  928.             self.flags = self.flags | FL_WATERJUMP;
  929.             self.velocity_z = 225;
  930.             self.flags = self.flags - (self.flags & FL_JUMPRELEASED);
  931.             self.teleport_time = time + 2;    // safety net
  932.             return;
  933.         }
  934.     }
  935. };
  936.  
  937.  
  938. /*
  939. ================
  940. PlayerPreThink
  941.  
  942. Called every frame before physics are run
  943. ================
  944. */
  945. void() PlayerPreThink =
  946. {
  947.     local    float    mspeed, aspeed;
  948.     local    float    r;
  949.  
  950.     if (intermission_running)
  951.     {
  952.         IntermissionThink ();    // otherwise a button could be missed between
  953.         return;                    // the think tics
  954.     }
  955.  
  956.     if (self.view_ofs == '0 0 0')
  957.         return;        // intermission or finale
  958.  
  959.     makevectors (self.v_angle);        // is this still used
  960.  
  961.     CheckRules ();
  962.     WaterMove ();
  963.  
  964.     if (self.waterlevel == 2)
  965.         CheckWaterJump ();
  966.  
  967.     if (self.deadflag >= DEAD_DEAD)
  968.     {
  969.         PlayerDeathThink ();
  970.         return;
  971.     }
  972.     
  973.     if (self.deadflag == DEAD_DYING)
  974.         return;    // dying, so do nothing
  975.  
  976.     if (self.button2)
  977.     {
  978.         PlayerJump ();
  979.     }
  980.     else
  981.         self.flags = self.flags | FL_JUMPRELEASED;
  982.  
  983. // teleporters can force a non-moving pause time    
  984.     if (time < self.pausetime)
  985.         self.velocity = '0 0 0';
  986. };
  987.     
  988. /*
  989. ================
  990. CheckPowerups
  991.  
  992. Check for turning off powerups
  993. ================
  994. */
  995. void() CheckPowerups =
  996. {
  997.     if (self.health <= 0)
  998.         return;
  999.  
  1000. // invisibility
  1001.     if (self.invisible_finished)
  1002.     {
  1003. // sound and screen flash when items starts to run out
  1004.         if (self.invisible_sound < time)
  1005.         {
  1006.             sound (self, CHAN_AUTO, "items/inv3.wav", 0.5, ATTN_IDLE);
  1007.             self.invisible_sound = time + ((random() * 3) + 1);
  1008.         }
  1009.  
  1010.  
  1011.         if (self.invisible_finished < time + 3)
  1012.         {
  1013.             if (self.invisible_time == 1)
  1014.             {
  1015.                 sprint (self, "Ring of Shadows magic is fading\n");
  1016.                 stuffcmd (self, "bf\n");
  1017.                 sound (self, CHAN_AUTO, "items/inv2.wav", 1, ATTN_NORM);
  1018.                 self.invisible_time = time + 1;
  1019.             }
  1020.             
  1021.             if (self.invisible_time < time)
  1022.             {
  1023.                 self.invisible_time = time + 1;
  1024.                 stuffcmd (self, "bf\n");
  1025.             }
  1026.         }
  1027.  
  1028.         if (self.invisible_finished < time)
  1029.         {    // just stopped
  1030.             self.items = self.items - IT_INVISIBILITY;
  1031.             self.invisible_finished = 0;
  1032.             self.invisible_time = 0;
  1033.         }
  1034.         
  1035.     // use the eyes
  1036.         self.frame = 0;
  1037.         self.modelindex = modelindex_eyes;
  1038.     }
  1039.     else
  1040.         self.modelindex = modelindex_player;    // don't use eyes
  1041.  
  1042. // invincibility
  1043.     if (self.invincible_finished)
  1044.     {
  1045. // sound and screen flash when items starts to run out
  1046.         if (self.invincible_finished < time + 3)
  1047.         {
  1048.             if (self.invincible_time == 1)
  1049.             {
  1050.                 sprint (self, "Protection is almost burned out\n");
  1051.                 stuffcmd (self, "bf\n");
  1052.                 sound (self, CHAN_AUTO, "items/protect2.wav", 1, ATTN_NORM);
  1053.                 self.invincible_time = time + 1;
  1054.             }
  1055.             
  1056.             if (self.invincible_time < time)
  1057.             {
  1058.                 self.invincible_time = time + 1;
  1059.                 stuffcmd (self, "bf\n");
  1060.             }
  1061.         }
  1062.         
  1063.         if (self.invincible_finished < time)
  1064.         {    // just stopped
  1065.             self.items = self.items - IT_INVULNERABILITY;
  1066.             self.invincible_time = 0;
  1067.             self.invincible_finished = 0;
  1068.         }
  1069.         if (self.invincible_finished > time)
  1070.             self.effects = self.effects | EF_DIMLIGHT;
  1071.         else
  1072.             self.effects = self.effects - (self.effects & EF_DIMLIGHT);
  1073.     }
  1074.  
  1075. // super damage
  1076.     if (self.super_damage_finished)
  1077.     {
  1078.  
  1079. // sound and screen flash when items starts to run out
  1080.  
  1081.         if (self.super_damage_finished < time + 3)
  1082.         {
  1083.             if (self.super_time == 1)
  1084.             {
  1085.                 sprint (self, "Quad Damage is wearing off\n");
  1086.                 stuffcmd (self, "bf\n");
  1087.                 sound (self, CHAN_AUTO, "items/damage2.wav", 1, ATTN_NORM);
  1088.                 self.super_time = time + 1;
  1089.             }      
  1090.             
  1091.             if (self.super_time < time)
  1092.             {
  1093.                 self.super_time = time + 1;
  1094.                 stuffcmd (self, "bf\n");
  1095.             }
  1096.         }
  1097.  
  1098.         if (self.super_damage_finished < time)
  1099.         {    // just stopped
  1100.             self.items = self.items - IT_QUAD;
  1101.             self.super_damage_finished = 0;
  1102.             self.super_time = 0;
  1103.         }
  1104.         if (self.super_damage_finished > time)
  1105.             self.effects = self.effects | EF_DIMLIGHT;
  1106.         else
  1107.             self.effects = self.effects - (self.effects & EF_DIMLIGHT);
  1108.     }    
  1109.  
  1110. // suit    
  1111.     if (self.radsuit_finished)
  1112.     {
  1113.         self.air_finished = time + 12;        // don't drown
  1114.  
  1115. // sound and screen flash when items starts to run out
  1116.         if (self.radsuit_finished < time + 3)
  1117.         {
  1118.             if (self.rad_time == 1)
  1119.             {
  1120.                 sprint (self, "Air supply in Biosuit expiring\n");
  1121.                 stuffcmd (self, "bf\n");
  1122.                 sound (self, CHAN_AUTO, "items/suit2.wav", 1, ATTN_NORM);
  1123.                 self.rad_time = time + 1;
  1124.             }
  1125.             
  1126.             if (self.rad_time < time)
  1127.             {
  1128.                 self.rad_time = time + 1;
  1129.                 stuffcmd (self, "bf\n");
  1130.             }
  1131.         }
  1132.  
  1133.         if (self.radsuit_finished < time)
  1134.         {    // just stopped
  1135.             self.items = self.items - IT_SUIT;
  1136.             self.rad_time = 0;
  1137.             self.radsuit_finished = 0;
  1138.         }
  1139.     }    
  1140.  
  1141. };
  1142.  
  1143.  
  1144. /*
  1145. ================
  1146. PlayerPostThink
  1147.  
  1148. Called every frame after physics are run
  1149. ================
  1150. */
  1151. void() PlayerPostThink =
  1152. {
  1153.     local    float    mspeed, aspeed;
  1154.     local    float    r;
  1155.  
  1156.     if (self.view_ofs == '0 0 0')
  1157.         return;        // intermission or finale
  1158.     if (self.deadflag)
  1159.         return;
  1160.         
  1161. // do weapon stuff
  1162.  
  1163.     W_WeaponFrame ();
  1164.  
  1165. // check to see if player landed and play landing sound    
  1166.     if ((self.jump_flag < -300) && (self.flags & FL_ONGROUND) && (self.health > 0))
  1167.     {
  1168.         if (self.watertype == CONTENT_WATER)
  1169.             sound (self, CHAN_BODY, "player/h2ojump.wav", 1, ATTN_NORM);
  1170.         else if (self.jump_flag < -650)
  1171.         {
  1172.             T_Damage (self, world, world, 5); 
  1173.             sound (self, CHAN_VOICE, "player/land2.wav", 1, ATTN_NORM);
  1174.             self.deathtype = "falling";
  1175.         }
  1176.         else
  1177.             sound (self, CHAN_VOICE, "player/land.wav", 1, ATTN_NORM);
  1178.  
  1179.         self.jump_flag = 0;
  1180.     }
  1181.  
  1182.     if (!(self.flags & FL_ONGROUND))
  1183.         self.jump_flag = self.velocity_z;
  1184.  
  1185.     CheckPowerups ();
  1186. };
  1187.  
  1188.  
  1189. /*
  1190. ===========
  1191. ClientConnect
  1192.  
  1193. called when a player connects to a server
  1194. ============
  1195. */
  1196. void() ClientConnect =
  1197. {
  1198.     bprint (self.netname);
  1199.     bprint (" entered the game\n");
  1200.     
  1201. // a client connecting during an intermission can cause problems
  1202.     if (intermission_running)
  1203.         ExitIntermission ();
  1204. };
  1205.  
  1206.  
  1207. /*
  1208. ===========
  1209. ClientDisconnect
  1210.  
  1211. called when a player disconnects from a server
  1212. ============
  1213. */
  1214. void() ClientDisconnect =
  1215. {
  1216.     if (gameover)
  1217.         return;
  1218.     // if the level end trigger has been activated, just return
  1219.     // since they aren't *really* leaving
  1220.  
  1221.     // let everyone else know
  1222.     bprint (self.netname);
  1223.     bprint (" left the game with ");
  1224.     bprint (ftos(self.frags));
  1225.     bprint (" frags\n");
  1226.     sound (self, CHAN_BODY, "player/tornoff2.wav", 1, ATTN_NONE);
  1227.     set_suicide_frame ();
  1228. };
  1229.  
  1230. /*
  1231. ===========
  1232. ClientObituary
  1233.  
  1234. called when a player dies
  1235. ============
  1236. */
  1237. void(entity targ, entity attacker) ClientObituary =
  1238. {
  1239.     local    float rnum;
  1240.     local    string deathstring, deathstring2;
  1241.     rnum = random();
  1242.  
  1243.     if (targ.classname == "player")
  1244.     {
  1245.         if (attacker.classname == "teledeath")
  1246.         {
  1247.             bprint (targ.netname);
  1248.             bprint (" was telefragged by ");
  1249.             bprint (attacker.owner.netname);
  1250.             bprint ("\n");
  1251.  
  1252.                         //*** Check to see if mega scoring (teamplay = 4) is on
  1253.                         //*** DMMODES Adjustment
  1254.                         if (teamplay != 4)
  1255.                         {
  1256.                                 attacker.owner.frags = attacker.owner.frags + 1;
  1257.                                 if ((teamplay == 2) || (teamplay == 3))
  1258.                                         targ.frags = targ.frags - 1;
  1259.                         }
  1260.                         return;
  1261.         }
  1262.  
  1263.         if (attacker.classname == "teledeath2")
  1264.         {
  1265.             bprint ("Satan's power deflects ");
  1266.             bprint (targ.netname);
  1267.             bprint ("'s telefrag\n");
  1268.  
  1269.                         if (teamplay != 4)
  1270.                         {
  1271.                                 if ((teamplay == 2) || (teamplay == 3))
  1272.                                         attacker.owner.frags = attacker.owner.frags + 1;
  1273.                                 targ.frags = targ.frags - 1;
  1274.                         }
  1275.             return;
  1276.         }
  1277.  
  1278.         if (attacker.classname == "player")
  1279.         {
  1280.             if (targ == attacker)
  1281.             {
  1282.                 // killed self
  1283.                 attacker.frags = attacker.frags - 1;
  1284.                 bprint (targ.netname);
  1285.                 
  1286.                 if (targ.weapon == 64 && targ.waterlevel > 1)
  1287.                 {
  1288.                     bprint (" discharges into the water.\n");
  1289.                     return;
  1290.                 }
  1291.                 if (targ.weapon == 16)
  1292.                     bprint (" tries to put the pin back in\n");
  1293.                                 else if (random() > 0.5)
  1294.                     bprint (" becomes bored with life\n");
  1295.                 else
  1296.                     bprint (" checks if his weapon is loaded\n");
  1297.                 return;
  1298.             }
  1299.             else
  1300.             {
  1301.                                 if (teamplay != 4)
  1302.                                 {
  1303.                                         attacker.frags = attacker.frags + 1;
  1304.                                         if ((teamplay == 2) || (teamplay == 3))
  1305.                                                 targ.frags = targ.frags - 1;
  1306.                                 }
  1307.  
  1308.                 rnum = attacker.weapon;
  1309.                 if (rnum == IT_AXE)
  1310.                 {
  1311.                     deathstring = " was ax-murdered by ";
  1312.                     deathstring2 = "\n";
  1313.                 }
  1314.                 if (rnum == IT_SHOTGUN)
  1315.                 {
  1316.                     deathstring = " chewed on ";
  1317.                     deathstring2 = "'s boomstick\n";
  1318.                 }
  1319.                 if (rnum == IT_SUPER_SHOTGUN)
  1320.                 {
  1321.                     deathstring = " ate 2 loads of ";
  1322.                     deathstring2 = "'s buckshot\n";
  1323.                                         if (targ.health < -40)
  1324.                                         {
  1325.                                                 deathstring = " was gibbed by ";
  1326.                                                 deathstring2 = "'s big gun\n";
  1327.                                         }
  1328.                 }
  1329.                 if (rnum == IT_NAILGUN)
  1330.                 {
  1331.                     deathstring = " was nailed by ";
  1332.                     deathstring2 = "\n";
  1333.                 }
  1334.                 if (rnum == IT_SUPER_NAILGUN)
  1335.                 {
  1336.                                         if (random() < 0.5)
  1337.                                                 deathstring = " was punctured by ";
  1338.                                         else
  1339.                                                 deathstring = " was swiss-cheesed by ";
  1340.                     deathstring2 = "\n";
  1341.                 }
  1342.                 if (rnum == IT_GRENADE_LAUNCHER)
  1343.                 {
  1344.                     deathstring = " eats ";
  1345.                     deathstring2 = "'s pineapple\n";
  1346.                     if (targ.health < -40)
  1347.                     {
  1348.                         deathstring = " was gibbed by ";
  1349.                         deathstring2 = "'s grenade\n";
  1350.                     }
  1351.                 }
  1352.                 if (rnum == IT_ROCKET_LAUNCHER)
  1353.                 {
  1354.                                         if (random() < 0.5)
  1355.                                                 deathstring = " rides ";
  1356.                                         else
  1357.                                                 deathstring = " swallows ";
  1358.                     deathstring2 = "'s rocket\n";
  1359.                     if (targ.health < -40)
  1360.                     {
  1361.                         deathstring = " was gibbed by ";
  1362.                         deathstring2 = "'s rocket\n" ;
  1363.                     }
  1364.                 }
  1365.                 if (rnum == IT_LIGHTNING)
  1366.                 {
  1367.                     deathstring = " accepts ";
  1368.                     if (attacker.waterlevel > 1)
  1369.                         deathstring2 = "'s discharge\n";
  1370.                     else
  1371.                         deathstring2 = "'s shaft\n";
  1372.                 }
  1373.                 bprint (targ.netname);
  1374.                 bprint (deathstring);
  1375.                 bprint (attacker.netname);
  1376.                 bprint (deathstring2);
  1377.             }
  1378.             return;
  1379.         }
  1380.         else
  1381.         {
  1382.             targ.frags = targ.frags - 1;        // killed self
  1383.             rnum = targ.watertype;
  1384.  
  1385.             bprint (targ.netname);
  1386.             if (rnum == -3)
  1387.             {
  1388.                 if (random() < 0.5)
  1389.                     bprint (" sleeps with the fishes\n");
  1390.                 else
  1391.                     bprint (" sucks it down\n");
  1392.                 return;
  1393.             }
  1394.             else if (rnum == -4)
  1395.             {
  1396.                 if (random() < 0.5)
  1397.                     bprint (" gulped a load of slime\n");
  1398.                 else
  1399.                     bprint (" can't exist on slime alone\n");
  1400.                 return;
  1401.             }
  1402.             else if (rnum == -5)
  1403.             {
  1404.                 if (targ.health < -15)
  1405.                 {
  1406.                     bprint (" burst into flames\n");
  1407.                     return;
  1408.                 }
  1409.                 if (random() < 0.5)
  1410.                     bprint (" turned into hot slag\n");
  1411.                 else
  1412.                     bprint (" visits the Volcano God\n");
  1413.                 return;
  1414.             }
  1415.  
  1416.             if (attacker.flags & FL_MONSTER)
  1417.             {
  1418.                 if (attacker.classname == "monster_army")
  1419.                     bprint (" was shot by a Grunt\n");
  1420.  
  1421.                 if (attacker.classname == "monster_demon1")
  1422.                     bprint (" was eviscerated by a Fiend\n");
  1423.  
  1424.                 if (attacker.classname == "monster_dog")
  1425.                                         if (random() < 0.5)
  1426.                                                 bprint (" was mauled by a Rottweiler\n");
  1427.                                         else
  1428.                                                 bprint (" became dog food\n");
  1429.  
  1430.                 if (attacker.classname == "monster_enforcer")
  1431.                     bprint (" was blasted by an Enforcer\n");
  1432.  
  1433.                 if (attacker.classname == "monster_fish")
  1434.                                         if (random() < 0.5)
  1435.                                                 bprint (" was fed to the Rotfish\n");
  1436.                                         else
  1437.                                                 bprint (" became fish fodder\n");
  1438.  
  1439.                 if (attacker.classname == "monster_hell_knight")
  1440.                     bprint (" was slain by a Death Knight\n");
  1441.  
  1442.                                 if (attacker.classname == "monster_knight")
  1443.                                         if (random() < 0.5)
  1444.                                                 bprint (" was slashed by a Knight\n");
  1445.                                         else
  1446.                                                 bprint (" took a Knight's sword to the gut\n");
  1447.  
  1448.                 if (attacker.classname == "monster_ogre")
  1449.                     bprint (" was destroyed by an Ogre\n");
  1450.  
  1451.                 if (attacker.classname == "monster_oldone")
  1452.                     bprint (" became one with Shub-Niggurath\n");
  1453.  
  1454.                 if (attacker.classname == "monster_shalrath")
  1455.                     bprint (" was exploded by a Vore\n");
  1456.  
  1457.                 if (attacker.classname == "monster_shambler")
  1458.                     bprint (" was smashed by a Shambler\n");
  1459.  
  1460.                 if (attacker.classname == "monster_tarbaby")
  1461.                     bprint (" was slimed by a Spawn\n");
  1462.  
  1463.                 if (attacker.classname == "monster_vomit")
  1464.                     bprint (" was vomited on by a Vomitus\n");
  1465.  
  1466.                 if (attacker.classname == "monster_wizard")
  1467.                     bprint (" was scragged by a Scrag\n");
  1468.  
  1469.                 if (attacker.classname == "monster_zombie")
  1470.                     bprint (" joins the Zombies\n");
  1471.                                 
  1472.                                 //*** Monster Deathmatch Edited ***//
  1473.                                 if (deathmatch > 4)
  1474.                                         targ.frags = targ.frags + 1;
  1475.                                 //*** This makes it so players do not ***//
  1476.                                 //*** lose frags if they're killed by ***//
  1477.                                 //*** a monster when respawning is    ***//
  1478.                                 //*** On - DM 5 or 6.                 ***//
  1479.  
  1480.                 return;
  1481.             }
  1482.             if (attacker.classname == "explo_box")
  1483.             {
  1484.                 bprint (" blew up\n");
  1485.                 return;
  1486.             }
  1487.             if (attacker.solid == SOLID_BSP && attacker != world)
  1488.             {    
  1489.                                 if (random() < 0.5)
  1490.                                         bprint (" was squished\n");
  1491.                                 else
  1492.                                         bprint (" was flattened\n");
  1493.                 return;
  1494.             }
  1495.             if (targ.deathtype == "falling")
  1496.             {
  1497.                 targ.deathtype = "";
  1498.                 bprint (" fell to his death\n");
  1499.                 return;
  1500.             }
  1501.             if (attacker.classname == "trap_shooter" || attacker.classname == "trap_spikeshooter")
  1502.             {
  1503.                 bprint (" was spiked\n");
  1504.                 return;
  1505.             }
  1506.             if (attacker.classname == "fireball")
  1507.             {
  1508.                 bprint (" ate a lavaball\n");
  1509.                 return;
  1510.             }
  1511.             if (attacker.classname == "trigger_changelevel")
  1512.             {
  1513.                 bprint (" tried to leave\n");
  1514.                 return;
  1515.             }
  1516.  
  1517.             bprint (" died\n");
  1518.         }
  1519.     }
  1520. };
  1521.